const designWidth = 1920;
const baseFont = 17;
const minWidth = 1366;
const maxWidth = 2560;

function setRemFontSize() {
    let width = window.innerWidth;
    width = Math.max(minWidth, Math.min(width, maxWidth));
    document.documentElement.style.fontSize = (width / designWidth * baseFont) + 'px';
}

// 首次加载
setRemFontSize();
// 监听窗口变化
window.addEventListener('resize', setRemFontSize);

export default setRemFontSize;
